package r2118d1127;

import java.util.Comparator;
import java.util.TreeSet;

public class Demo02TreeSet {
    public static void main(String[] args) {
        TreeSet<Student> treeSet = new TreeSet<>(new Comparator<Student>() {
            @Override
            public int compare(Student o1, Student o2) {
                int ret = (int)(o1.getScore()-o2.getScore());
                return ret;
            }
        });
        treeSet.add(new Student(70.0,"张三","00001"));
        treeSet.add(new Student(55.0,"李四","00002"));
        treeSet.add(new Student(60.0,"王五","00003"));
        treeSet.add(new Student(40.0,"赵六","00004"));
        treeSet.add(new Student(80.0,"吴七","00005"));
        treeSet.forEach(s-> System.out.println(s));

    }
}
